// let path = require('path');
// let fs = require('fs');
// let content = '';
// fs.readFile(path.join(__dirname,'1,txt'),'utf-8',(err,date) =>{
//    if(err){console.log(err);}
//    else{
//       content += date + '\n';
//       fs.readFile(path.join(__dirname,'2,txt'),'utf-8',(err,date) =>{
//          if(err){console.log(err);}
//          else{
//             content += date;
//             console.log(content);
//             fs.writeFile(path.join(__dirname,'3,text'),content,(err) =>{
//                if(err){console.log(err);}
//                else{
//                   console.log('success');
//                }
//             })
//          }
//       })
//    }
// });



let data = [
   {name:'A',score:90},
   {name:'B',score:82},
   {name:'C',score:100},
   {name:'D',score:71},
   {name:'E',score:81},
   {name:'F',score:92},
   {name:'G',score:72},
   {name:'H',score:61},
   {name:'I',score:71},
   {name:'J',score:51},
   {name:'K',score:90},
   {name:'L',score:82},
   {name:'M',score:74},
   {name:'N',score:71},
   {name:'O',score:81}
]

let array = data.map((item) =>{
   const{ score } = item;
   
   if(score >= 90){
      return '优'
   }else if(score >= 75&&score < 90){
      return'良'
   }else if(score >=60 && score<75){
      return'中等'
   }else {
      return '差'
   }
})

let map = new Map();

array.forEach((item)=>{

   let count = map.get(item);

   if(count){

      map.set(item,count+1);
   }else{
      map.set(item,1);
   }
})

console.log(map);




